package cn.hackcloud.annotation.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import cn.hackcloud.annotation.bean.Car;

/**
 * Bean的生命周期 构造（对象创建） 
 * 单实例：在容器启动时候创建 
 * 多实例：在获取是创建
 * 初始化：对象创建完成，调用初始化方法
 * 销毁：容器关闭
 * 
 * @author Created by laijun on 2018/11/09
 */
@ComponentScan("cn.hackcloud.annotation.bean")
@Configuration
public class MainConfigOfLifeCycle {
	@Scope("prototype")
	@Bean(initMethod = "init", destroyMethod = "destory")
	public Car car() {
		return new Car();
	}
}
